//
//  SupplierViewCell.m
//  EastMarket
//
//  Created by 李鹏程 on 16/11/17.
//  Copyright © 2016年 guoguo. All rights reserved.
//

#import "SupplierViewCell.h"

@implementation SupplierViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    if (self == [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        CGFloat spacing = 8.0f;
        CGFloat border = 1.0f;
        CGFloat lblHeight = 22.0f;
        
        // 产品icon
        _imgProductIcon = [[UIImageView alloc] initWithFrame:CGRectMake(spacing, spacing, 80 - 2 * spacing, 80 - 2 * spacing)];
        _imgProductIcon.backgroundColor = [UIColor clearColor];
        [self.contentView addSubview:_imgProductIcon];
        
        // 产品名称
        _lblSuppierName = [[UILabel alloc] init];
        _lblSuppierName.frame = CGRectMake(_imgProductIcon.frame.origin.x + spacing + _imgProductIcon.frame.size.width, spacing, SCREEN_WIDTH - _imgProductIcon.frame.origin.x - _imgProductIcon.frame.size.width - 2 * spacing, lblHeight);
        _lblSuppierName.font = [UIFont systemFontOfSize:16];
        _lblSuppierName.textColor = EastMarket_darkBlackFontColor;
        [self.contentView addSubview:_lblSuppierName];
        
        _lblSuppierPhone = [[UILabel alloc] init];
        _lblSuppierPhone.frame = CGRectMake(_lblSuppierName.frame.origin.x, _lblSuppierName.frame.origin.y + _lblSuppierName.frame.size.height, (SCREEN_WIDTH - _imgProductIcon.frame.origin.x - _imgProductIcon.frame.size.width - 3 * spacing - border) * 2 / 3, lblHeight);
        _lblSuppierPhone.textColor = EastMarket_darkGreyFontColor;
        [_lblSuppierPhone setFont:[UIFont systemFontOfSize:14]];
        [self.contentView addSubview:_lblSuppierPhone];
        
        _rightImg = [[UIImageView alloc] initWithFrame:CGRectMake(SCREEN_WIDTH - 24, _lblSuppierPhone.frame.origin.y, 16, 16)];
        _rightImg.image = [UIImage imageNamed:@"rightArrow"];
        [self.contentView addSubview:_rightImg];
        
        _lblSupplierAddress = [[UILabel alloc] init];
        _lblSupplierAddress.frame = CGRectMake(_imgProductIcon.frame.origin.x + spacing + _imgProductIcon.frame.size.width, _lblSuppierPhone.frame.origin.y + _lblSuppierPhone.frame.size.height, SCREEN_WIDTH - _imgProductIcon.frame.origin.x - _imgProductIcon.frame.size.width - 2 * spacing, lblHeight);
        _lblSupplierAddress.textColor = EastMarket_darkGreyFontColor;
        _lblSupplierAddress.font = [UIFont systemFontOfSize:14];
        [self.contentView addSubview:_lblSupplierAddress];
        
        
        //        UIView *viewSpacing = [[UIView alloc] initWithFrame:CGRectMake(_btnNumReduce.frame.origin.x,_lblProductNum.frame.origin.y + _lblProductNum.frame.size.height + spacing, SCREEN_WIDTH, 1)];
        //        [self addSubview:viewSpacing];
        //        viewSpacing.backgroundColor = EastMarket_bordColor;
    }
    
    return self;
}



@end
